<template>
    <div>
        <el-button type="primary"  @click="showOrder()">售后入库订单查询</el-button>
        <el-button type="primary"  @click="showRepo()">售后入库单查询</el-button>
        <br><br>
        <!--查询-->
        <div class="search-box">
            <el-form :inline="true" class="demo-form-inline" size="mini">

                <el-form-item label="入库订单编号">
                    <el-input placeholder="入库订单编号" v-model="search.inorderCode"></el-input>
                </el-form-item>

                <el-form-item label="返厂入库标志">
                    <el-select v-model="search.status" placeholder="返厂入库标志">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="未入库" value=0></el-option>
                        <el-option label="已入库" value=1></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="售后入库订单类型">
                    <el-select v-model="search.type" placeholder="审核状态">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="返厂维修入库" value=1></el-option>
                        <el-option label="售后换货入库" value=2></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="售后入库订单日期">
                    <el-date-picker
                            v-model="createTime"
                            @change="chooseTime"
                            type="datetimerange"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            range-separator="-"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            align="left">
                    </el-date-picker>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="findPage" icon="el-icon-search">搜索</el-button>
                    <el-button type="warning" @click="resetForm" icon="el-icon-refresh-right">重置</el-button>
                </el-form-item>

            </el-form>
        </div>


        <!--展示-->
        <div class="table-box">
            <el-table height="400" border :data="inOrderList" :stripe="true" style="width: 95%">

                <el-table-column type="index" width="50" label="序号"></el-table-column>

                <el-table-column prop="inorderCode" label="返厂入库单号"></el-table-column>

                <el-table-column prop="type" label="售后入库订单类型">
                    <template #default="slotProps">
                        <span v-if="slotProps.row.type===0">未入库</span>
                        <span v-if="slotProps.row.type===1">返厂维修入库</span>
                        <span v-if="slotProps.row.type===2">售后退换货维修入库</span>
                    </template>
                </el-table-column>

                <el-table-column prop="status" label="返厂入库标志">
                    <template #default="slotProps">
                        <span v-if="slotProps.row.status===0">未入库</span>
                        <span v-if="slotProps.row.status===1">已入库</span>
                    </template>
                </el-table-column>

                <el-table-column prop="createBy" label="制单人"></el-table-column>

                <el-table-column prop="createTime" label="订单日期" :formatter="creatFormatter"></el-table-column>

                <el-table-column label="操作">
                    <template #default="slotProps">
                        <el-button type="primary" round size="mini" @click="showInfo(slotProps.row)">查看</el-button>
                        <el-button type="warning" round size="mini" @click="generateBill(slotProps.row.id)"
                                   v-if="slotProps.row.gened===0">生成入库单
                        </el-button>
                    </template>
                </el-table-column>

            </el-table>
        </div>

        <!--分页组件-->
        <div class="page-box">
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="currentPage"
                    :page-sizes="[5, 10, 15, 20]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
            </el-pagination>
        </div>
    </div>

</template>

<script>
    import RepInAfterSale from "./index";

    export default RepInAfterSale;
</script>

<style scoped src="./index.scss" lang="scss">

</style>